package meconsea.life.buddy.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import meconsea.life.sys.entity.AbsEntity;

import org.hibernate.annotations.Type;

@Entity
@Table(name="BUDDY_MSG")
@NamedQueries({
	@NamedQuery(name=BuddyMsg.BUDDY_MSG_FIND_RECEIVE,query="SELECT O FROM BuddyMsg O where O.receiver=:receiver and O.isRead=:isRead order by O.sendTime")
})
public class BuddyMsg extends AbsEntity {
	public final static String BUDDY_MSG_FIND_RECEIVE="buddy_msg_find_receive";
	@Column(name="sender",length=64)
	private String sender;
	
	@Column(name="receiver",length=64)
	private String receiver;
	
	@Column(name="isRead")
	@Type(type="integer")
	private Integer isRead;
	
	@Column(name="msg")
	@Type(type="text")
	private String msg;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="sendtime")
	private Date sendTime=new Date();
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="receivetime")
	private Date receiveTime;

	public String getSender() {
		return sender;
	}

	public void setSender(String sender) {
		this.sender = sender;
	}

	public String getReceiver() {
		return receiver;
	}

	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	public Integer getIsRead() {
		return isRead;
	}

	public void setIsRead(Integer isRead) {
		this.isRead = isRead;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Date getSendTime() {
		return sendTime;
	}

	public void setSendTime(Date sendTime) {
		this.sendTime = sendTime;
	}

	public Date getReceiveTime() {
		return receiveTime;
	}

	public void setReceiveTime(Date receiveTime) {
		this.receiveTime = receiveTime;
	}
	
}
